import 'package:flutter/material.dart';
import '../../flutter_dk_form.dart';
import 'widget_input.dart';

class MultipleRemarkWidget extends StatefulWidget {
  final String title;
  //占位符
  final String placeholder;
  //最多输入文字
  final int maxLength;
  //文本控制器
  final TextEditingController controller;
  //是否显示底部最多显示字数的文本
  final bool showWaringText;
  //焦点
  final FocusNode focusNode;
  //占位符风格
  final TextStyle placeholderStyle;
  //文字风格
  final TextStyle textStyle;
  //最多少字文字风格
  final TextStyle waringTextStyle;
  //文字背景颜色
  final Color textBgColor;
  //文字背景颜色
  final Color bgColor;
  //是否可编辑
  final bool readOnly;
  //内容区高度
  final double contentHeight;
  //按下return（完成键）键收起键盘
  final bool returnKeyDownKeyBoard;

  /// 标题样式，详见TitleTextStyle
  final TitleTextStyle titleTextStyle;

  /// [hasLine]：是否有下划线(false=标题自带下划线右侧无边距，ture=标题无下划线显示自带下划线左右边距16)
  final bool hasLine;

  MultipleRemarkWidget(
      {this.title = "",
      this.placeholder = "",
      this.maxLength = 100,
      @required this.controller,
      this.showWaringText = false,
      this.focusNode,
      this.textStyle,
      this.waringTextStyle,
      this.placeholderStyle,
      this.textBgColor,
      this.bgColor,
      this.readOnly = false,
      this.contentHeight = 65,
      this.returnKeyDownKeyBoard = true,
      this.titleTextStyle,
      this.hasLine = true});
  @override
  _InputStatefulWidgetState createState() => _InputStatefulWidgetState();
}

class _InputStatefulWidgetState extends State<MultipleRemarkWidget> {
  final double countHeight = 20;
  @override
  Widget build(BuildContext context) {
    return Container(
      color: Colors.white,
      child: Column(
        children: <Widget>[
          TitleWidget(widget.title,
              hasLine: !widget.hasLine, titleTextStyle: widget.titleTextStyle),
          Visibility(
              visible: widget.hasLine,
              child: Divider(
                  height: 0.5,
                  indent: 16,
                  endIndent: 16,
                  color: Color(0xFFEBEBEB))),
          SizedBox(
            height: 16,
          ),
          InputWidget(
            placeholder: this.widget.placeholder,
            maxLength: this.widget.maxLength,
            controller: this.widget.controller,
            showWaringText: this.widget.showWaringText,
            focusNode: this.widget.focusNode,
            textStyle: this.widget.textStyle,
            waringTextStyle: this.widget.waringTextStyle,
            placeholderStyle: this.widget.placeholderStyle,
            textBgColor: this.widget.textBgColor,
            bgColor: this.widget.bgColor,
            readOnly: this.widget.readOnly,
            contentHeight: this.widget.contentHeight,
            returnKeyDownKeyBoard: this.widget.returnKeyDownKeyBoard,
          ),
        ],
      ),
    );
  }
}
